package cn.myj2c.executor.providers;

import cn.myj2c.executor.Context;
import cn.myj2c.executor.values.JavaValue;
import org.objectweb.asm.Type;

import java.util.List;

public abstract class FieldProvider implements Provider {
    @Override
    public boolean canCheckInstanceOf(JavaValue target, Type type, Context context) {
        return false;
    }

    @Override
    public boolean canCheckcast(JavaValue target, Type type, Context context) {
        return false;
    }

    @Override
    public boolean canInvokeMethod(String className, String methodName, String methodDesc, JavaValue targetObject, List<JavaValue> args, Context context) {
        return false;
    }

    @Override
    public boolean canCheckEquality(JavaValue first, JavaValue second, Context context) {
        return false;
    }

    @Override
    public Object invokeMethod(String className, String methodName, String methodDesc, JavaValue targetObject, List<JavaValue> args, Context context) {
        throw new IllegalStateException("Cannot invoke method on FieldProvider");
    }

    @Override
    public boolean instanceOf(JavaValue target, Type type, Context context) {
        throw new IllegalStateException("Cannot check instanceof on FieldProvider");
    }

    @Override
    public boolean checkEquality(JavaValue first, JavaValue second, Context context) {
        throw new IllegalStateException("Cannot check equality on FieldProvider");
    }

    @Override
    public boolean checkcast(JavaValue target, Type type, Context context) {
        throw new IllegalStateException("Cannot check cast on FieldProvider");
    }
}
